//
//  AppDelegate.swift
//  statusBar_tabBar_safeArea_height
//
//  Created by 郭扬扬 on 2021/10/31.
//

import UIKit

@main
class AppDelegate: UIResponder, UIApplicationDelegate {


var window: UIWindow?
    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
        
        window = UIWindow.init(frame: UIScreen.main.bounds)
        window?.rootViewController = TestViewController()
        
        window?.makeKeyAndVisible()
        setGlobalConstant()
        return true
    }


    //设置全局变量
    func setGlobalConstant()  {
        //ios11，动态设置属性值
            if #available(iOS 11.0, *) {
                guard  let  top = window?.safeAreaInsets.top else{
                    return
                }
                guard  let bottom = window?.safeAreaInsets.bottom else {
                    return
                }
                //状态栏
                kStatusBarHeight = top
                //导航栏 + 状态栏
                kNavBarAndStatusBarHeight = kStatusBarHeight + kNavigationBarH
                //底部安全区
                kSafeAreaBottomH = bottom
                //tabbar + 底部安全区
                kTabBarAndSafeAreaH = kTabBarH + kSafeAreaBottomH
            
        }
    }

}

